/* Copyright 2018 JDCLOUD.COM

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http:#www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

returnRule
渠道管理平台返还规则

OpenAPI spec version: v1
Contact: 

NOTE: This class is auto generated by the jdcloud code generator program.
*/

#import <Foundation/Foundation.h>
#import <JDCloudOCSDKPartner/PartnerApiModel.h>


@implementation PartnerQueryMyCustomerListRequest
-(id) initWithRegion:(NSString *)regionId
customerPin:(NSString*)customerPin
aliasName:(NSString*)aliasName
startRelTime:(NSString*)startRelTime
endRelTime:(NSString*)endRelTime
pageIndex:(NSNumber*)pageIndex
pageSize:(NSNumber*)pageSize { 
    self.regionId = regionId;
    self.customerPin = customerPin;
    self.aliasName = aliasName;
    self.startRelTime = startRelTime;
    self.endRelTime = endRelTime;
    self.pageIndex = pageIndex;
    self.pageSize = pageSize;
    return self;
}

-(id) initWithRegion:(NSString *)regionId
             version:(NSString *)version
customerPin:(NSString*)customerPin
aliasName:(NSString*)aliasName
startRelTime:(NSString*)startRelTime
endRelTime:(NSString*)endRelTime
pageIndex:(NSNumber*)pageIndex
pageSize:(NSNumber*)pageSize { 
    self.regionId = regionId;
    self.version = version;
    self.customerPin = customerPin;
    self.aliasName = aliasName;
    self.startRelTime = startRelTime;
    self.endRelTime = endRelTime;
    self.pageIndex = pageIndex;
    self.pageSize = pageSize;
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    NSMutableDictionary *superObjectDic = [super dictionary];
    if(superObjectDic && [superObjectDic count]>0)
    {
        [result addEntriesFromDictionary:superObjectDic];
    }
    if([self customerPin])
    {
        [result setValue:[self customerPin] forKey:@"customerPin"];
    }
    if([self aliasName])
    {
        [result setValue:[self aliasName] forKey:@"aliasName"];
    }
    if([self startRelTime])
    {
        [result setValue:[self startRelTime] forKey:@"startRelTime"];
    }
    if([self endRelTime])
    {
        [result setValue:[self endRelTime] forKey:@"endRelTime"];
    }
    if([self pageIndex])
    {
        [result setValue:[self pageIndex] forKey:@"pageIndex"];
    }
    if([self pageSize])
    {
        [result setValue:[self pageSize] forKey:@"pageSize"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.customerPin = [dictionary objectForKey:@"customerPin"];
    self.aliasName = [dictionary objectForKey:@"aliasName"];
    self.startRelTime = [dictionary objectForKey:@"startRelTime"];
    self.endRelTime = [dictionary objectForKey:@"endRelTime"];
    self.pageIndex = [dictionary objectForKey:@"pageIndex"];
    self.pageSize = [dictionary objectForKey:@"pageSize"];
    return self;
} 

@end
@implementation PartnerQueryMyCustomerListResult
-(id) initWithPagination:(Pagination*) pagination
        result:(NSArray<Customer*>*)result { 
    self.pagination = pagination;               
    self.result = result;               
    return self;
}
-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self pagination])
    {
        [result setValue:[[self pagination] dictionary]forKey:@"pagination"];
    }
    if([self result])
    {
            NSMutableArray<NSDictionary*>* arrayDic  = [[NSMutableArray alloc] init];
            for (int i =0 ; i< [[self result] count]; i++) {
            Customer* item = [[self result] objectAtIndex:i];
            [arrayDic addObject:[item dictionary]];
        }
        [result setValue:arrayDic forKey:@"result"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.pagination = [[Pagination alloc]initWithDic:[dictionary objectForKey:@"pagination"]];
    NSArray* resultArray = [dictionary objectForKey:@"result"];
    if(resultArray&&![resultArray isKindOfClass:[NSNull class]])
    {
        NSMutableArray* propertyArray = [[NSMutableArray alloc]init];
        for(int i = 0 ; i< [resultArray count];i++)
        {
        Customer* item = [[Customer alloc]initWithDic:[resultArray objectAtIndex:i]];
            if(item)
            {
            [propertyArray addObject:item];
            }
        }
        self.result = propertyArray;
    }
    return self;
} 

@end
  
@implementation PartnerQueryMyCustomerListResponse
-(NSMutableDictionary*) dictionary
{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init]; 
    if([self requestId])
    {
        [result setValue:[self requestId] forKey:@"requestId"];
    } 
    if([self result])
    {
        
        [result setValue:[[self result] dictionary] forKey:@"result"];
    }
    if([self error])
    {
        
        [result setValue:[[self error] dictionary] forKey:@"error"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary
{
    
    self.requestId = [dictionary objectForKey:@"requestId"];
PartnerQueryMyCustomerListResult* result = [[PartnerQueryMyCustomerListResult alloc]initWithDic:[dictionary objectForKey:@"result"]];
    self.result = result;
    ServiceError* error = [[ServiceError alloc]initWithDic:[dictionary objectForKey:@"error"]];
    self.error = error;
    return self;
}

-(id) initWithRequestId:(NSString*) requestId
                  error:(ServiceError*) error
                 result:(PartnerQueryMyCustomerListResult*) result
{
    self.error = error;
    self.result =result;
    self.requestId = requestId;
    return self;
}

@end
 
